package lc.数组;

/**
 * @description:  最大连续 1 的个数
 * @author: qian
 * @createDate: 2021/8/25
 */
public class Math485 {

    public int findMaxConsecutiveOnes(int[] nums) {

        int sum = 0;
        int max = 0;
        for(int num : nums) {
            if(num == 1) {
                sum ++;
                max = Math.max(max,sum);
            }
            else {
                sum = 0;
            }
        }
        return max;

    }
}
